package com.hs.server.service.impl;

import com.google.protobuf.Message;
import com.googlecode.protobuf.format.JsonFormat;
import com.hs.grpc.*;
import com.hs.server.service.JianyanHsService;
import io.grpc.ManagedChannel;
import io.grpc.netty.shaded.io.grpc.netty.NegotiationType;
import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Description
 * @Author: chenjiarui
 * @Date: 2021-07-15 10:26
 */
@Data
@Slf4j
public class JianyanHsServiceImpl implements JianyanHsService {
    //channel通道，主要用于通信
    private ManagedChannel channel;
    //stub存根，我们客户端需要远程调用服务，在得到stub后，只需要调用stub的相应服务即可
    private JianYanHsServiceGrpc.JianYanHsServiceBlockingStub blockingStub;

    public JianyanHsServiceImpl(String ip, int dkh) {
        if (channel == null){
            this.channel = NettyChannelBuilder.forAddress(ip, dkh)
                    .negotiationType(NegotiationType.PLAINTEXT).usePlaintext()
                    .build();
            this.blockingStub = JianYanHsServiceGrpc.newBlockingStub(channel);
        }
    }

    @Override
    public String CheckAppearance(String jyx, CheckAppearanceRequest request) {
        String resuest = getRequest(request);
        log.info("【车辆外观-请求信息】{}",resuest);
        CheckAppearanceReply response = blockingStub.checkAppearance(request);
        String result = JsonFormat.printToString(response);
        log.info("【车辆外观-来自服务端的信息】" + result);//解决字符串中文输出8进制的问题
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_001_001"://车牌识别
                case "jy_002_001":
                    resultMap.put(v, response.getPlateRight());
                    break;
                case "jy_001_002"://三脚架目标检测
                case "jy_002_002":
                    resultMap.put(v,response.getTripodExist());
                    break;
                case "jy_001_003"://车身颜色
                    resultMap.put(v,response.getColorRight());
                    break;
                case "jy_002_003":
                    resultMap.put(v,response.getColorBrRight());
                    break;
                case "jy_001_004"://车辆类型
                    resultMap.put(v,response.getTypeRight());
                    break;
                case "jy_001_005"://车辆历史图片相似度比对
                    resultMap.put(v,response.getOriginalAppearanceArchivalImg());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckVin(String jyx, String clsbdh, CheckVinRequest request) {
        String resuest = getRequest(request);
        log.info("【Vin车架号-请求信息】{}",resuest);
        CheckVinReply response = blockingStub.checkVin(request);
        String result = JsonFormat.printToString(response);
        log.info("【Vin车架号-来自服务端的信息】" + result);
        log.info("【Vin车架号-识别的车架号】" + response.getDetAns());
        log.info("【Vin车架号-正确的车架号】" + clsbdh);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_003_001"://车架号识别
                    resultMap.put(v,response.getVinRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckSeatBelt(String jyx, CheckSeatBeltRequest request) {
        String resuest = getRequest(request);
        log.info("【安全带-请求信息】{}",resuest);
        CheckSeatBeltReply response = blockingStub.checkSeatBelt(request);
        String result = JsonFormat.printToString(response);
        log.info("【安全带-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_015_001":// 安全带
                    resultMap.put(v,response.getSeatBeltRight());
                    break;
                case "jy_015_002":// 反光背心
                    resultMap.put(v,response.getReflectiveCoatRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckLicenseApplicationForm(String jyx,CheckLicenseApplicationFormRequest request) {
        String resuest = getRequest(request);
        log.info("【机动车牌证申请表-请求信息】{}",resuest);
        CheckLicenseApplicationFormReply response = blockingStub.checkLicenseApplicationForm(request);
        String result = JsonFormat.printToString(response);
        log.info("【机动车牌证申请表-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_018_001"://车牌识别
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_018_002"://所有人
                    resultMap.put(v, response.getAgentNameExist());
                    break;
                case "jy_018_003"://所有人联系电话
                    resultMap.put(v,response.getTelephoneExist());
                    break;
                case "jy_018_004"://日期
                    resultMap.put(v,response.getDateExist());
                    break;
                case "jy_018_005"://号牌种类
                    resultMap.put(v,response.getPlateTypeRight());
                    break;
                case "jy_018_006"://车辆所有人手写签名
                    resultMap.put(v,response.getCarOwmerSignatureExist());
                    break;
                case "jy_018_007"://打勾
                    resultMap.put(v,response.getBRegistrationAreaTick());
                    break;
                case "jy_018_008"://抵押权人手写签名
                    resultMap.put(v,response.getMortgageeSignatureExist());
                    break;
                case "jy_018_009"://是否机动车牌证申请表
                    resultMap.put(v,response.getForm());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckInsurancePolicy(String jyx, CheckInsurancePolicyRequest request) {
        String resuest = getRequest(request);
        log.info("【交强险保单-请求信息】{}",resuest);
        CheckInsurancePolicyReply response = blockingStub.checkInsurancePolicy(request);
        String result = JsonFormat.printToString(response);
        log.info("【交强险保单-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_019_001"://车牌识别
                    resultMap.put(v,response.getPlateRight());
                    break;
                case "jy_019_002"://车架号识别
                    resultMap.put(v,response.getVinRight());
                    break;
                case "jy_019_003"://检验日期是否在保险有效期内
                    resultMap.put(v,response.getDateValid());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckVehicleLicense(String jyx, CheckVehicleLicenseRequest request) {
        String resuest = getRequest(request);
        log.info("【行驶证-请求信息】{}",resuest);
        CheckVehicleLicenseReply response = blockingStub.checkVehicleLicense(request);
        String result = JsonFormat.printToString(response);
        log.info("【行驶证-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_017_001"://车牌识别
                case "jy_027_001":
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_017_002"://车架号识别
                case "jy_027_004":
                    resultMap.put(v,response.getVinRight());
                    break;
                case "jy_017_003"://行驶证编号
                case "jy_027_005":
                    resultMap.put(v,response.getLicenseNumberRight());
                    break;
                case "jy_017_004"://车辆类型
                case "jy_027_002":
                    resultMap.put(v,response.getVehicleTypeRight());
                    break;
                case "jy_017_005"://所有人
                case "jy_027_003":
                    resultMap.put(v,response.getOwnerRight());
                    break;
                case "jy_017_006"://发动机号
                case "jy_027_006":
                    resultMap.put(v,response.getEngineNumberRight());
                    break;
                case "jy_017_007"://发证日期
                case "jy_027_007":
                    resultMap.put(v,response.getIssueDateRight());
                    break;
                case "jy_017_008"://行驶证主页正面
                case "jy_027_008":
                    resultMap.put(v,false);
                    break;
                case "jy_017_009"://行驶证副页正面
                case "jy_027_009":
                case "jy_028_001":
                    resultMap.put(v,false);
                    break;
                case "jy_017_010"://身份证正面
                    resultMap.put(v,false);
                    break;
                case "jy_027_010"://送检人
                    resultMap.put(v,response.getIdCardNameRight());
                    break;
            }
        });
        //行驶证编号答案为空，则默认该检验项jy_005_003通过
        if (StringUtils.isBlank(request.getLicenseAnswer())&&jyx.contains("jy_005_003")){
            resultMap.put("jy_005_003",true);
        }
        //发证日期答案为空，则默认该检验项jy_005_004通过
        if (StringUtils.isBlank(request.getIssueDateAnswer())&&jyx.contains("jy_005_004")){
            resultMap.put("jy_005_004",true);
        }
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckInspectionReport(String jyx, CheckInspectionReportRequest request) {
        String resuest = getRequest(request);
        log.info("【机动车安全技术检验报告-请求信息】{}",resuest);
        CheckInspectionReportReply response = blockingStub.checkInspectionReport(request);
        String result = JsonFormat.printToString(response);
        log.info("【机动车安全技术检验报告-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_020_001"://车牌识别
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_020_002"://车架号识别
                    resultMap.put(v,response.getVinRight());
                    break;
                case "jy_020_003"://检验结论
                    resultMap.put(v,response.getInspectionResultPass());
                    break;
                case "jy_020_004"://数据项
                    resultMap.put(v,response.getSignatureExist());
                    break;
                case "jy_020_005"://是否存在数据项不合格
                    resultMap.put(v,response.getAllPass());
                    break;
                case "jy_020_006"://印章检测
                    resultMap.put(v,response.getStampExist());
                    break;
                case "jy_020_007"://手写签名
                    resultMap.put(v,response.getSignatureExist());
                    break;
                case "jy_020_008"://CMA章检测
                    resultMap.put(v,response.getMaExist());
                    break;
                case "jy_020_009"://流水号
                    resultMap.put(v,response.getSerialRight());
                    break;
                case "jy_020_010"://是否机动车安全技术检验报告单
                    resultMap.put(v,response.getInspectionReport());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckExhaustDetectionReport(String jyx, CheckExhaustDetectionReportRequest request) {
        String resuest = getRequest(request);
        log.info("【尾气单-请求信息】{}",resuest);
        CheckExhaustDetectionReportReply response = blockingStub.checkExhaustDetectionReport(request);
        String result = JsonFormat.printToString(response);
        log.info("【尾气单-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_073_001"://车牌号
                case "jy_074_001"://
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_073_002"://车架号
                case "jy_074_002"://
                    resultMap.put(v,response.getVinRight());
                    break;
                case "jy_073_003"://检验结论
                case "jy_074_003"://
                    resultMap.put(v,response.getInspectionResultPass());
                    break;
                case "jy_073_004"://印章
                case "jy_074_004"://
                    resultMap.put(v,response.getUnitStampExist());
                    break;
                case "jy_073_005"://CMA印章
                case "jy_074_005"://
                    resultMap.put(v,response.getMAStampExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckVecicleLights(String jyx, String hphm, CheckVecicleLightsRequest request) {
        String resuest = getRequest(request);
        log.info("【左、右灯光-请求信息】{}",resuest);
        CheckVecicleLightsReply response = blockingStub.checkVecicleLights(request);
//        CheckVecicleLightsReply response = null;
//        String result = "";
        String result = JsonFormat.printToString(response);
        log.info("【左、右灯光-来自服务端的信息】" + result);
        log.info("【PlateNumberRight】" + response.getPlateNumberRight()+"---【识别的车牌号】"+response.getPlateNumber()+"---【正确的车牌号】"+hphm);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_031_001"://左大灯
                    //resultMap.put(v,false);
                   resultMap.put(v,response.getLeftLightOn());
                    break;
                case "jy_041_001"://右大灯
                    //resultMap.put(v,false);
                    resultMap.put(v,response.getRightLightOn());
                    break;
                case "jy_031_002"://车牌号
                case "jy_041_002":
                    //resultMap.put(v,true);
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckVecicleBrake(String jyx, CheckVecicleBrakeRequest request) {
        String resuest = getRequest(request);
        log.info("【制动-请求信息】{}",resuest);
        CheckVecicleBrakeReply response = blockingStub.checkVecicleBrake(request);
        String result = JsonFormat.printToString(response);
        log.info("【制动-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                //制动
                case "jy_037_001"://车轮位置
                case "jy_038_001":
                case "jy_039_001":
                case "jy_040_001":
                case "jy_043_001":
                case "jy_076_001":
                case "jy_044_001":
                case "jy_045_001":
                case "jy_046_001":
                //驻车
                case "jy_075_001":
                case "jy_055_001":
                case "jy_056_001":
                case "jy_057_001":
                case "jy_058_001":
                case "jy_059_001":
                    resultMap.put(v,response.getVecicleBrake());
                    break;
                case "jy_037_002"://车牌号
                case "jy_038_002":
                case "jy_039_002":
                case "jy_040_002":
                case "jy_043_002":
                case "jy_076_002":
                case "jy_044_002":
                case "jy_045_002":
                case "jy_046_002":
                    //驻车
                case "jy_075_002":
                case "jy_082_001":
                case "jy_083_001":
                case "jy_055_003":
                case "jy_056_003":
                case "jy_057_003":
                case "jy_058_003":
                case "jy_059_003":
                    resultMap.put(v, response.getPlateNumberRight());
                    break;
                case "jy_037_003"://制动灯
                case "jy_038_003":
                case "jy_039_003":
                case "jy_040_003":
                case "jy_043_003":
                case "jy_076_003":
                case "jy_044_003":
                case "jy_045_003":
                case "jy_046_003":
                //驻车
                case "jy_075_003":
                case "jy_055_002":
                case "jy_056_002":
                case "jy_057_002":
                case "jy_058_002":
                case "jy_059_002":
                    resultMap.put(v,response.getTaillightOn());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckChassisInspection(String jyx, CheckChassisInspectionRequest request) {
        String resuest = getRequest(request);
        log.info("【底盘检验-请求信息】{}",resuest);
        CheckChassisInspectionReply response = blockingStub.checkChassisInspection(request);
        String result = JsonFormat.printToString(response);
        log.info("【底盘检验-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            boolean bind = response.getHumanExist() || response.getHelmetExist();//绑定安全帽和人
            switch (v){
                //底盘部件（地沟, 年限>10年）
                case "jy_033_001"://安全帽
                case "jy_033_002"://人
                    resultMap.put(v,bind);
                    break;
                case "jy_033_003"://车牌号
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_033_004"://反光背心
                    resultMap.put(v,response.getHumanWithReflectiveVest());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckChassisDynamics(String jyx, CheckChassisDynamicsRequest request) {
        String resuest = getRequest(request);
        log.info("【底盘动态-请求信息】{}",resuest);
        CheckChassisDynamicsReply response = blockingStub.checkChassisDynamics(request);
        String result = JsonFormat.printToString(response);
        log.info("【底盘动态-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            double similar;
            switch (v){
                //底盘动态开始  （年限>10年）
                case "jy_035_001"://车牌号
                    resultMap.put(v, response.getBeginPlateNumberRight());
                    break;
                //底盘动态结束  （年限>10年）
                case "jy_035_002"://车牌号
                    resultMap.put(v, response.getEndPlateNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public boolean CheckFaceCompare(CheckFaceCompareRequest request) {
        return false;
    }

    @Override
    public String CheckAttorneyLetter(String jyx, CheckAttorneyLetterRequest request) {
        String resuest = getRequest(request);
        log.info("【委托书-请求信息】{}",resuest);
        CheckAttorneyLetterReply response = blockingStub.checkAttorneyLetter(request);
        String result = JsonFormat.printToString(response);
        log.info("【委托书-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                //委托书
                case "jy_024_001"://车牌号
                    resultMap.put(v,response.getPlateRight());
                    break;
                case "jy_024_002"://手写签字
                    resultMap.put(v,response.getSignatureExit());
                    break;
                case "jy_024_003"://是否代理人授权书
                    resultMap.put(v,response.getAttorneyLetter());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckInspectionFormManual(String jyx, String jyxm, CheckInspectionFormManualRequest request) {
        String resuest = getRequest(request);
        log.info("【安全技术检验表人工部分-请求信息】{}",resuest);
        CheckInspectionFormManualReply response = blockingStub.checkInspectionFormManual(request);
        String result = JsonFormat.printToString(response);
        log.info("【安全技术检验表人工部分-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                //检验表(人工部分)
                case "jy_032_001"://车牌号
                case "jy_072_001":
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_032_002"://流水号
                case "jy_072_002":
                    resultMap.put(v,response.getSerialRight());
                    break;
                case "jy_032_003"://外观检验员手写签名
                case "jy_072_003":
                    if (StringUtils.isNotBlank(jyxm) && jyxm.contains("F1"))
                        resultMap.put(v,response.getAppearanceInspectionSignatureExit());
                    else
                        resultMap.put(v,true);
                    break;
                case "jy_032_004"://引车检验员手写签名
                case "jy_072_004":
                    resultMap.put(v,response.getVehicleLeadSignatureExit());
                    break;
                case "jy_032_005"://底盘检验员手写签名
                case "jy_072_005":
                    if (StringUtils.isNotBlank(jyxm) && jyxm.contains("C1"))
                        resultMap.put(v,response.getChassisPartsSignatureExit());
                    else
                        resultMap.put(v,true);
                    break;
                case "jy_032_006"://底盘动态检验员手写签名
                case "jy_072_006":
                    if (StringUtils.isNotBlank(jyxm) && jyxm.contains("DC"))
                        resultMap.put(v,response.getChassisDynamicsSignatureExit());
                    else
                        resultMap.put(v,true);
                    break;
                case "jy_032_007"://是否检验表(人工检验部分)1
                case "jy_072_007"://是否检验表(人工检验部分)2
                    resultMap.put(v,response.getInspectionFormManual());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckInspectionRecordPerson(String jyx, CheckInspectionRecordPersonRequest request) {
        String resuest = getRequest(request);
        log.info("【检验过程记录人存在模块-请求信息】{}",resuest);
        CheckInspectionRecordPersonReply response = blockingStub.checkInspectionRecordPerson(request);
        String result = JsonFormat.printToString(response);
        log.info("【检验过程记录人存在模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
/*            switch (v){
                //检验表(人工部分)
                case "jy_021_001"://车牌号
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_021_002"://检验结论
                    resultMap.put(v,response.getInspectionResultPass());
                    break;
                case "jy_021_003"://检验员签字
                    resultMap.put(v,response.getSignatureExist());
                    break;
                case "jy_021_004"://印章
                    resultMap.put(v,response.getStampExist());
                    break;
            }*/
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckIdentificationCard(String jyx, CheckIdentificationCardRequest request) {
        String resuest = getRequest(request);
        log.info("【身份证识别模块-请求信息】{}",resuest);
        CheckIdentificationCardReply response = blockingStub.checkIdentificationCard(request);
        String result = JsonFormat.printToString(response);
        log.info("【身份证识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                //身份证
                case "jy_029_001"://是否存在身份证正面
                    resultMap.put(v,response.getIdCardFrontExit());
                    break;
                case "jy_029_002"://是否存在身份证反面
                    resultMap.put(v,response.getIdCardBackExit());
                    break;
                case "jy_029_003"://姓名是否一致
                    resultMap.put(v,response.getIdCardNameRight());
                    break;
                case "jy_029_004"://身份证号是否一致
                    resultMap.put(v,response.getIdCardNumberRight());
                    break;
                case "jy_029_005"://身份证是否在有效期
                    resultMap.put(v,response.getDateValideRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckGasTank(String jyx, CheckGasTankRequest request) {
        String resuest = getRequest(request);
        log.info("【改装气罐-请求信息】{}",resuest);
        CheckGasTankReply response = blockingStub.checkGasTank(request);
        String result = JsonFormat.printToString(response);
        log.info("【改装气罐-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_030_001"://改装气罐
                    resultMap.put(v,response.getGasTankExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckIdentificationCardCopy(String jyx, CheckIdentificationCardCopyRequest request) {
        return null;
    }

    @Override
    public String CheckVehicleLicenseBack(String jyx, CheckVehicleLicenseBackRequest request) {
        String resuest = getRequest(request);
        log.info("【行驶证背面识别模块-请求信息】{}",resuest);
        CheckVehicleLicenseBackReply response = blockingStub.checkVehicleLicenseBack(request);
        String result = JsonFormat.printToString(response);
        log.info("【行驶证背面识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_028_001"://行驶证背面
                    resultMap.put(v,response.getVehicleSmallPictureExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckFactoryCertificate(String jyx, CheckFactoryCertificateRequest request) {
        return null;
    }

    @Override
    public String CheckEngineNumber(String jyx, CheckEngineNumberRequest request) {
        String resuest = getRequest(request);
        log.info("【发动机识别模块-请求信息】{}",resuest);
        CheckEngineNumberReply response = blockingStub.checkEngineNumber(request);
        String result = JsonFormat.printToString(response);
        log.info("【发动机识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_007_001"://发动机号
                    resultMap.put(v,response.getEngineNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckTyreSpecification(String jyx, CheckTyreSpecificationRequest request) {
        String resuest = getRequest(request);
        log.info("【轮胎规格识别模块-请求信息】{}",resuest);
        CheckTyreSpecificationReply response = blockingStub.checkTyreSpecification(request);
        String result = JsonFormat.printToString(response);
        log.info("【轮胎规格识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_010_001"://轮胎规格是否一致
                case "jy_011_001":
                case "jy_012_001":
                case "jy_013_001":
                case "jy_014_001":
                case "jy_077_001":
                    resultMap.put(v,response.getTyreSpecificationRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckEmergencyHammer(String jyx, CheckEmergencyHammerRequest request) {
        String resuest = getRequest(request);
        log.info("【安全锤识别模块-请求信息】{}",resuest);
        CheckEmergencyHammerReply response = blockingStub.checkEmergencyHammer(request);
        String result = JsonFormat.printToString(response);
        log.info("【安全锤识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_005_001"://应急锤检测
                    resultMap.put(v,response.getEmergencyHammerRightExit());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckFireExtinguisher(String jyx, CheckFireExtinguisherRequest request) {
        String resuest = getRequest(request);
        log.info("【灭火器识别模块-请求信息】{}",resuest);
        CheckFireExtinguisherReply response = blockingStub.checkFireExtinguisher(request);
        String result = JsonFormat.printToString(response);
        log.info("【灭火器识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_097_001"://灭火器
                    resultMap.put(v,response.getFireExtinguisherRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckDriverRecorder(String jyx, CheckDriverRecorderRequest request) {
        String resuest = getRequest(request);
        log.info("【行驶记录装置识别模块-请求信息】{}",resuest);
        CheckDriverRecorderReply response = blockingStub.checkDriverRecorder(request);
        String result = JsonFormat.printToString(response);
        log.info("【行驶记录装置识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_006_001"://行驶记录仪检测
                    resultMap.put(v,response.getDriverRecorderRight());
                    break;
                case "jy_006_002"://3C标签检测
                    resultMap.put(v,response.getCccRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckAuxiliaryBrake(String jyx, CheckAuxiliaryBrakeRequest request) {
        String resuest = getRequest(request);
        log.info("【辅助制动装置识别模块-请求信息】{}",resuest);
        CheckAuxiliaryBrakeReply response = blockingStub.checkAuxiliaryBrake(request);
        String result = JsonFormat.printToString(response);
        log.info("【辅助制动装置识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_048_001"://辅助制动
                    resultMap.put(v,response.getAuxiliaryBrakeRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckAntilockBrakeSystem(String jyx, CheckAntilockBrakeSystemRequest request) {
        String resuest = getRequest(request);
        log.info("【防抱死制动装置识别模块-请求信息】{}",resuest);
        CheckAntilockBrakeSystemReply response = blockingStub.checkAntilockBrakeSystem(request);
        String result = JsonFormat.printToString(response);
        log.info("【防抱死制动装置识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_049_001"://ABS是否点亮
                    resultMap.put(v,response.getAntilockBrakeSystemRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckFaceFeatureExtract(String jyx, CheckFaceFeatureExtractRequest request) {
        return null;
    }

    @Override
    public String CheckBigVehicleAppearance(String jyx, CheckBigVehicleAppearanceRequest request) {
        return null;
    }

    @Override
    public String CheckVehicleLicenseRec(String jyx, CheckVehicleLicenseRecRequest request) {
        String resuest = getRequest(request);
        log.info("【行驶证正面识别模块-请求信息】{}",resuest);
        CheckVehicleLicenseRecReply response = blockingStub.checkVehicleLicenseRec(request);
        String result = JsonFormat.printToString(response);
        log.info("【行驶证正面识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_027_001"://车牌号
                    resultMap.put(v,response.getPlateRight());
                    break;
                case "jy_027_002"://车辆类型
                    break;
                case "jy_027_003"://所有人

                    break;
                case "jy_027_004"://车架号
                    resultMap.put(v,response.getVinRight());
                    break;
                case "jy_027_005"://行驶证编号(条形码)
                    resultMap.put(v,response.getLicenseNumberRight());
                    break;
                case "jy_027_006"://发动机号

                    break;
                case "jy_027_007"://发证日期
                    break;
                case "jy_027_008"://行驶证主页正面
                    break;
                case "jy_027_009"://行驶证副页正面
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckSafetyTechnicalInspectionFormInstrument(String jyx, CheckSafetyTechnicalInspectionFormInstrumentRequest request) {
        String resuest = getRequest(request);
        log.info("【检验表仪器部分模块-请求信息】{}",resuest);
        CheckSafetyTechnicalInspectionFormInstrumentReply response = blockingStub.checkSafetyTechnicalInspectionFormInstrument(request);
        String result = JsonFormat.printToString(response);
        log.info("【检验表仪器部分模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_036_001"://车牌号
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_036_002"://车架号后四位
                    resultMap.put(v,response.getVinRight());
                    break;
                case "jy_036_003"://项目全部合格
                    resultMap.put(v,response.getInspectionResultPass());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckFactoryCertificateRec(CheckFactoryCertificateRecRequest request) {
        return null;
    }


    @Override
    public String CheckBusinessLicense(String jyx, CheckBusinessLicenseRequest request) {
        String resuest = getRequest(request);
        log.info("【营业执照识别模块-请求信息】{}",resuest);
        CheckBusinessLicenseReply response = blockingStub.checkBusinessLicense(request);
        String result = JsonFormat.printToString(response);
        log.info("【营业执照识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_051_001"://是否是营业执照
                    resultMap.put(v,response.getBusinessLicense());
                    break;
                case "jy_051_002"://社会信用代码是否存在
                    resultMap.put(v,response.getCreditCodeRight());
                    break;
                case "jy_051_003"://印章是否存在
                    resultMap.put(v,response.getStampExist());
                    break;
                case "jy_051_004"://名称是否正确
                    resultMap.put(v,response.getNameRight());
                    break;
                case "jy_051_005"://营业期限是否正确
                    resultMap.put(v,response.getBusinessTermRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckMotorAppearance(String jyx, CheckMotorAppearanceRequest request) {
        String resuest = getRequest(request);
        log.info("【摩托车外观识别模块-请求信息】{}",resuest);
        CheckMotorAppearanceReply response = blockingStub.checkMotorAppearance(request);
        String result = JsonFormat.printToString(response);
        log.info("【摩托车外观识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_080_001"://车牌号
                    resultMap.put(v,response.getBLicensePlateRight());
                    break;
                case "jy_080_002"://左前图片车身颜色
                    resultMap.put(v,response.getBMotorColorRight());
                    break;
                case "jy_080_003"://车标
                    resultMap.put(v,response.getBMotorLogoRight());
                    break;
                case "jy_080_004"://头盔
                    resultMap.put(v,response.getBHelmetExist());
                    break;
                case "jy_080_005"://排气孔
                    resultMap.put(v,response.getBExhaustPipeRefitted());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckMotorLights(String jyx, CheckMotorLightRequest request) {
        String resuest = getRequest(request);
        log.info("【摩托车灯光识别模块-请求信息】{}",resuest);
        CheckMotorLightReply response = blockingStub.checkMotorLight(request);
        String result = JsonFormat.printToString(response);
        log.info("【摩托车灯光识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_082_001"://车牌号
                    resultMap.put(v,response.getBPlateNumberRight());
                    break;
                case "jy_082_002"://灯光
                    resultMap.put(v,response.getBLightOn());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckMotorChassisDynamics(String jyx, CheckMotorChassisDynamicsRequest request) {
        String resuest = getRequest(request);
        log.info("【摩托车底盘动态识别模块-请求信息】{}",resuest);
        CheckMotorChassisDynamicsReply response = blockingStub.checkMotorChassisDynamics(request);
        String result = JsonFormat.printToString(response);
        log.info("【摩托车底盘动态识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_083_001"://底盘动态开始车牌号码与答案是否一致
                case "jy_084_001":
                    resultMap.put(v,response.getBPlateNumberRight());
                    //resultMap.put(v,StrUtil.similar(response.getPlateNumber(), request.getPlateAnswer()) > 0.6);
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckMotorBrake(String jyx, CheckMotorBrakeRequest request) {
        String resuest = getRequest(request);
        log.info("【摩托车一轴、二轴、驻车制动识别模块-请求信息】{}",resuest);
        CheckMotorBrakeReply response = blockingStub.checkMotorBrake(request);
        String result = JsonFormat.printToString(response);
        log.info("【摩托车一轴、二轴、驻车制动识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_085_001"://车轮
                case "jy_086_001":
                case "jy_087_001":
                    resultMap.put(v,response.getBMotorBrakeRight());
                    break;
                case "jy_085_002"://车牌号
                case "jy_086_002":
                case "jy_087_002":
                    resultMap.put(v,response.getBPlateNumberRight());
                    break;
                case "jy_085_003"://尾灯
                case "jy_086_003":
                case "jy_087_003":
                    resultMap.put(v,response.getBTailLightOn());
                    break;
                case "jy_085_004"://车辆颜色
                case "jy_086_004":
                case "jy_087_004":
                    resultMap.put(v,response.getBMotorColorRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckNameplate(String jyx, CheckNameplateRequest request) {
        String resuest = getRequest(request);
        log.info("【车辆铭牌识别模块-请求信息】{}",resuest);
        CheckNameplateReply response = blockingStub.checkNameplate(request);
        String result = JsonFormat.printToString(response);
        log.info("【车辆铭牌识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_042_001"://车辆品牌是否正确
                    resultMap.put(v,response.getBrandsRight());
                    break;
                case "jy_042_002"://车辆型号是否正确
                    resultMap.put(v,response.getCarModelRight());
                    break;
                case "jy_042_003"://发动机型号是否正确
                    resultMap.put(v,response.getEngineModelRight());
                    break;
                case "jy_042_005"://制造日期是否正确
                    resultMap.put(v,response.getManufactureDateRight());
                    break;
                case "jy_042_006"://制造国是否正确
                    resultMap.put(v,response.getManufactureCountryRight());
                    break;
                case "jy_042_007"://排量是否正确
                    resultMap.put(v,response.getDisplacementRight());
                    break;
                case "jy_042_008"://总质量是否正确
                    resultMap.put(v,response.getTotalQualityRight());
                    break;
                case "jy_042_009"://车架号是否正确
                    resultMap.put(v,response.getVinRight());
                    break;
                case "jy_042_010"://制造厂商名称是否正确
                    resultMap.put(v,response.getManufactureNameRight());
                    break;
                case "jy_042_011"://核定载客人数是否正确
                    resultMap.put(v,response.getPassengerNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckVanInside(String jyx, CheckVanInsideRequest request) {
        String resuest = getRequest(request);
        log.info("【检查车厢内部识别模块-请求信息】{}",resuest);
        CheckVanInsideReply response = blockingStub.checkVanInside(request);
        String result = JsonFormat.printToString(response);
        log.info("【检查车厢内部识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_004_001"://车厢是否改装
                    resultMap.put(v,response.getVanRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckBusInside(String jyx, CheckBusInsideRequest request) {
        String resuest = getRequest(request);
        log.info("【检查座位数和安全带识别模块-请求信息】{}",resuest);
        CheckBusInsideReply response = blockingStub.checkBusInside(request);
        String result = JsonFormat.printToString(response);
        log.info("【检查座位数和安全带识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_004_001"://车厢是否改装
                    resultMap.put(v,false);
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckVehRear(String jyx, CheckVehRearRequest request) {
        String resuest = getRequest(request);
        log.info("【车辆正后方照片识别模块-请求信息】{}",resuest);
        CheckVehRearReply response = blockingStub.checkVehRear(request);
        String result = JsonFormat.printToString(response);
        log.info("【车辆正后方照片识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_016_001"://车牌号
                case "jy_081_001":
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_016_002"://刹车灯
                    resultMap.put(v,false);
                    break;
                case "jy_016_003"://反光标识
                    resultMap.put(v,false);
                    break;
                case "jy_016_004"://防护板
                    resultMap.put(v,false);
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckVehFront(String jyx, CheckVehFrontRequest request) {
        String resuest = getRequest(request);
        log.info("【车辆正前方照片识别模块-请求信息】{}",resuest);
        CheckVehFrontReply response = blockingStub.checkVehFront(request);
        String result = JsonFormat.printToString(response);
        log.info("【车辆正前方照片识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_080_001"://车牌号
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }
    @Override
    public String CheckWheelLoad(String jyx, CheckWheelLoadRequest request) {
        String resuest = getRequest(request);
        log.info("【轮重照片识别模块-请求信息】{}",resuest);
        CheckWheelLoadReply response = blockingStub.checkWheelLoad(request);
        String result = JsonFormat.printToString(response);
        log.info("【轮重照片识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_088_001"://车牌号
                case "jy_089_001":
                case "jy_090_001":
                case "jy_091_001":
                case "jy_092_001":
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckCurbWeight(String jyx, CheckCurbWeightRequest request) {
        String resuest = getRequest(request);
        log.info("【整备质量照片识别模块-请求信息】{}",resuest);
        CheckCurbWeightReply response = blockingStub.checkCurbWeight(request);
        String result = JsonFormat.printToString(response);
        log.info("【整备质量照片识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_093_001"://车牌号
                case "jy_094_001":
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckExternalContour(String jyx, CheckExternalContourRequest request) {
        String resuest = getRequest(request);
        log.info("【外廓照片识别模块-请求信息】{}",resuest);
        CheckExternalContourReply response = blockingStub.checkExternalContour(request);
        String result = JsonFormat.printToString(response);
        log.info("【外廓照片识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_063_002"://车牌号
                case "jy_064_002":
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
                case "jy_063_001"://制动灯
                case "jy_064_001":
                    resultMap.put(v,false);
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckSideslip(String jyx, CheckSideslipRequest request) {
        String resuest = getRequest(request);
        log.info("【侧滑照片识别模块-请求信息】{}",resuest);
        CheckSideslipReply response = blockingStub.checkSideslip(request);
        String result = JsonFormat.printToString(response);
        log.info("【侧滑照片识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_042_001"://车牌号
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckRoadTestTravellingBrake(String jyx, CheckRoadTestBrakeRequest request) {
        String resuest = getRequest(request);
        log.info("【路试行车制动识别模块-请求信息】{}",resuest);
        CheckRoadTestBrakeReply response = blockingStub.checkRoadTestTravellingBrake(request);
        String result = JsonFormat.printToString(response);
        log.info("【路试行车制动识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_034_001"://车牌号
                case "jy_034_002"://车牌号
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckRoadTestsLopeBrake(String jyx, CheckRoadTestsLopeBrakeRequest request) {
        String resuest = getRequest(request);
        log.info("【路试坡度驻车制动识别模块-请求信息】{}",resuest);
        CheckRoadTestsLopeBrakeReply response = blockingStub.checkRoadTestsLopeBrake(request);
        String result = JsonFormat.printToString(response);
        log.info("【路试坡度驻车制动识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_095_001"://车牌号
                    resultMap.put(v,response.getPlateNumberRight());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckPassengerPedal(String jyx, CheckPassengerPedalRequest request) {
        String resuest = getRequest(request);
        log.info("【教练车副制动踏板识别模块-请求信息】{}",resuest);
        CheckPassengerPedalReply response = blockingStub.checkPassengerPedal(request);
        String result = JsonFormat.printToString(response);
        log.info("【教练车副制动踏板识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_099_001"://副制动踏板
                    resultMap.put(v,response.getPedalExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckVideoRecordingSystem(String jyx, CheckVideoRecordingSystemRequest request) {
        String resuest = getRequest(request);
        log.info("【校车、卧铺客车的车内外录像监控系统识别模块-请求信息】{}",resuest);
        CheckVideoRecordingSystemReply response = blockingStub.checkVideoRecordingSystem(request);
        String result = JsonFormat.printToString(response);
        log.info("【校车、卧铺客车的车内外录像监控系统识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_100_001"://摄像头
                    resultMap.put(v,response.getCameraExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckDangerousGoods(String jyx, CheckDangerousGoodsRequest request) {
        String resuest = getRequest(request);
        log.info("【危险货物运输车标志识别模块-请求信息】{}",resuest);
        CheckDangerousGoodsReply response = blockingStub.checkDangerousGoods(request);
        String result = JsonFormat.printToString(response);
        log.info("【危险货物运输车标志识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_101_001"://危险货物运输车标志检测
                    resultMap.put(v,response.getIdentificationExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    @Override
    public String CheckEmergencySwitch(String jyx, CheckEmergencySwitchRequest request) {
        String resuest = getRequest(request);
        log.info("【手动机械断电开关识别模块-请求信息】{}",resuest);
        CheckEmergencySwitchReply response = blockingStub.checkEmergencySwitch(request);
        String result = JsonFormat.printToString(response);
        log.info("【手动机械断电开关识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_102_001"://手动机械断电开关检测
                    resultMap.put(v,response.getSwitchExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    public String CheckCarExtinguisher(String jyx, CheckCarExtinguisherRequest request) {
        String resuest = getRequest(request);
        log.info("【发动机灭火器识别模块-请求信息】{}",resuest);
        CheckCarExtinguisherReply response = blockingStub.checkCarExtinguisher(request);
        String result = JsonFormat.printToString(response);
        log.info("【发动机灭火器识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_103_001"://发动机灭火器
                    resultMap.put(v,response.getCarExtinguisherExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    public String CheckBusStopSign(String jyx, CheckBusStopSignRequest request) {
        String resuest = getRequest(request);
        log.info("【校车停车牌标识识别模块-请求信息】{}",resuest);
        CheckBusStopSignReply response = blockingStub.checkBusStopSign(request);
        String result = JsonFormat.printToString(response);
        log.info("【校车停车牌标识识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_104_001"://校车停车牌标识
                    resultMap.put(v,response.getBusStopExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    public String CheckGearLever(String jyx, CheckGearLeverRequest request) {
        String resuest = getRequest(request);
        log.info("【辅助制动系统识别模块-请求信息】{}",resuest);
        CheckGearLeverReply response = blockingStub.checkGearLever(request);
        String result = JsonFormat.printToString(response);
        log.info("【辅助制动系统识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_105_001"://辅助制动系统
                    resultMap.put(v,response.getGearLeverExist());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    public String CheckInstrument(String jyx, CheckInstrumentRequest request) {
        String resuest = getRequest(request);
        log.info("【透光检测仪识别模块-请求信息】{}",resuest);
        CheckInstrumentReply response = blockingStub.checkInstrument(request);
        String result = JsonFormat.printToString(response);
        log.info("【透光检测仪识别模块-来自服务端的信息】" + result);
        List<String> jyxList = Arrays.asList(jyx.split(","));
        Map<String,Boolean> resultMap = new HashedMap();
        jyxList.forEach(v->{
            switch (v){
                case "jy_106_001"://透光检测仪读数
                    resultMap.put(v,response.getIsQualified());
                    break;
            }
        });
        return getBtgjyx(resultMap,result,resuest);
    }

    /**
     * 获取map中值为false的不通过项
     * @param resultMap
     * @param result grpc识别返回
     * @return
     */
    private String getBtgjyx(Map<String,Boolean> resultMap,String result,String request){
        StringBuffer sb = new StringBuffer();
        //返回resultMap中值为false的jyx(单元测试已测通)
        String btgjyx = resultMap.entrySet().stream().filter(map->map.getValue()==false).map(map-> map.getKey()).collect(Collectors.joining(","));
        //sb.append(btgjyx).append("---").append(StringUtils.isNotBlank(result)? result:"{调用grpc无输出返回}");
        sb.append(btgjyx).append("---##---").append(result).append("---##---").append(request);
        return sb.toString();
    }

    private String getRequest(Message o){
        return JsonFormat.printToString(o);
    }
}
